var footImg = ["../../img/home_cn/home-box-1_CN.jpg","../../img/home_cn/home-box-2_CN.jpg","../../img/home_cn/home-box-3_CN.jpg"]; //存放底部左边的三张图片路径
var footHImg = ["../../img/home_cn/home-box-1_CN_hover.jpg","../../img/home_cn/home-box-2_CN_hover.jpg","../../img/home_cn/home-box-3_CN_hover.jpg"]; //存放底部左边的三张hover图片路径
var rightArr = ["../../img/home_cn/weibo_CN.jpg","../../img/home_cn/weixin_CN.jpg"]; //存放底部右边的两张图片路径
var rightHArr = ["../../img/home_cn/weibo_CN_hover.jpg","../../img/home_cn/weixin_CN_hover.jpg"]; //存放底部右边的两张hover图片路径
//存放右边动画效果图的路径
var picArr = [];
var tgbArr = [];
var TArr = [];
var WArr = [];
//国际化
function setLanguage(obj) {
	$("#topChina").html(obj.topCountry);
	$("#language a").html(obj.topA);
	$("header>nav>a>li>span").eq(0).html(obj.news);
	$("header>nav>a>li>span").eq(1).html(obj.menu);
	$("header>nav>a>li>span").eq(2).html(obj.develop);
	$("header>nav>a>li>span").eq(3).html(obj.about);
	$("header>nav>a>li>span").eq(4).html(obj.local);
	$("#slideNav>li>a").eq(0).html(obj.value);
	$("#slideNav>li>a").eq(1).html(obj.classics);
	$("#slideNav>li>a").eq(2).html(obj.premium);
	$("#slideNav>li>a").eq(3).html(obj.lowFat);
	$("#slideNav>li>a").eq(4).html(obj.wrap);
	$("#slideNav>li>a").eq(5).html(obj.salad);
	$("#slideNav>li>a").eq(6).html(obj.catering);
	$("#slideNav>li>a").eq(7).html(obj.drinksAndSides);
	$("#slideNav>li>a").eq(8).html(obj.breakfast);
	$("#slideNav>li>a").eq(9).html(obj.nutrition);
	$("#slideNav>li>a").eq(10).html(obj.howToOrder);
	$("#animatePicContainer>img").eq(1).prop("src", obj.TArr[0]);
	$("#animatePicContainer>img").eq(2).prop("src", obj.WArr[0]);
	TArr = obj.TArr;
	WArr = obj.WArr;
	$("#footerLeft>img").eq(0).prop("src", obj.footLeftImg[0]);
	$("#footerLeft>img").eq(1).prop("src", obj.footLeftImg[1]);
	$("#footerLeft>img").eq(2).prop("src", obj.footLeftImg[2]);
	$("#footerRight>img").eq(0).prop("src", obj.rightArr[0]);
	$("#footerRight>img").eq(1).prop("src", obj.rightArr[1]);
	footImg = obj.footLeftImg;
	footHImg = obj.footLeftHImg;
	rightArr = obj.rightArr;
	rightHArr = obj.rightHArr;
}
//设置语言
$("select ").change(function() {
	if($("select :nth-child(2)").prop("selected") == true) {
		setLanguage(enObj);
		footImgHover("#footerLeft :first-child", footHImg[0], footImg[0]);
		footImgHover("#footerLeft :nth-child(2)", footHImg[1], footImg[1]);
		footImgHover("#footerLeft :last-child", footHImg[2], footImg[2]);
		footImgHover("#footerRight :first-child", rightHArr[0], rightArr[0]);
		footImgHover("#footerRight :last-child", rightHArr[1], rightArr[1]);
	} else if($("select :nth-child(3)").prop("selected") == true) {
		setLanguage(cnObj);
		footImgHover("#footerLeft :first-child", footHImg[0], footImg[0]);
		footImgHover("#footerLeft :nth-child(2)", footHImg[1], footImg[1]);
		footImgHover("#footerLeft :last-child", footHImg[2], footImg[2]);
		footImgHover("#footerRight :first-child", rightHArr[0], rightArr[0]);
		footImgHover("#footerRight :last-child", rightHArr[1], rightArr[1]);
	}
});

//封装图片hover效果
function footImgHover(obj, path1, path2) { 
	$(obj).hover(function() {
		$(obj).prop("src", path1);
	}, function() {
		$(obj).prop("src", path2);
	});
}
footImgHover("#footerLeft :first-child", footHImg[0], footImg[0]);
footImgHover("#footerLeft :nth-child(2)", footHImg[1], footImg[1]);
footImgHover("#footerLeft :last-child", footHImg[2], footImg[2]);
footImgHover("#footerRight :first-child", rightHArr[0], rightArr[0]);
footImgHover("#footerRight :last-child", rightHArr[1], rightArr[1]);
$("#footerRight :last-child").hover(function() { //给微信加hover出二维码的效果
	$("#QRcode").css("display", "block");
}, function() {
	$("#QRcode").css("display", "none");
});

//下拉菜单栏
$("#liSlide").hover(function() {
	$("#slideNav").css("display", "block");
}, function() {
	$("#slideNav").css("display", "none");
})
$("#slideNav").on("mouseleave", function() {
	$("#slideNav").css("display", "none");
})
$("#slideNav").on("mouseenter", function() {
	$("#slideNav").css("display", "block");
})
//下拉菜单栏的hover
$("#slideNav>li").hover(function() {
	$(this).children("a").css("color", "yellow");
}, function() {
	$(this).children("a").css("color", "white");
})
//新闻页中部动画效果
setTimeout(function(){
	$("#leftDiv").animate({left: 0},500);
	$("#rightDiv").animate({left: "610px"},500);
},800);
//点击下面三张图的事件
$("#footerLeft>img").eq(0).on("click",function(){
	window.location.href = "position.html";
})
$("#footerLeft>img").eq(1).on("click",function(){
	window.location.href = "howtoorder.html";
})
$("#footerLeft>img").eq(2).on("click",function(){
	window.location.href = "sales.html";
})